<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title></title>
	</head>
	<body>
		
	</body>
	<script type="text/javascript">
		// 大整形
		let n = 521n;
		console.log(n, typeof n);// 521n "bigint"
		
		// 函数
		let m = 123;
		console.log(BigInt(m));// 123n
		// console.log(BigInt(1.2));// 必须是整数   浮点数会报错
		
		// 大数值运算
		let max = Number.MAX_SAFE_INTEGER;// 最大安全整数
		console.log(max);		// 9007199254740991
		console.log(max + 1);	// 9007199254740992
		console.log(max + 2);	// 9007199254740992 // 不能表示更大的运算结果
		
		// 通过BigInt做转换   BigInt和BigInt做运算
		console.log(BigInt(max));		// 9007199254740991n  
		console.log(BigInt(max) + BigInt(1));	// 9007199254740992n
		console.log(BigInt(max) + BigInt(2));	// 9007199254740993n
	</script>
</html>
